package com.yuanda.wordhot.entity;

import java.sql.Timestamp;
import java.util.Date;
import java.util.Set;

import org.apache.commons.lang3.StringUtils;

/**
 * @author YuBai
 * @since 2013-3-19
 * @Description 用户实体
 * @version 1.0
 */
public class UserEntity implements IEntity{

	/**
	 * 
	 */
	private static final long serialVersionUID = 7478217353198615455L;

	private Long userId;
    private String email;
    private String password;
    private String nickName;
    private String realName;
    
    private IdTypeEntity idType;//一对一
    private String idNumber;
    private String gender;
    private Date birthday;
    private Date registerDate;
    private Timestamp lastLoginTime;
    private Integer loginTimes;
    private Double longitude;
    private Double latitude;
    private Set<RoleEntity> roles;//角色   一对多
    private String userRole;//采用,分割
    
	public Long getUserId() {
		return userId;
	}
	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getNickName() {
		return nickName;
	}
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	public String getRealName() {
		return realName;
	}
	public void setRealName(String realName) {
		this.realName = realName;
	}

	public IdTypeEntity getIdType() {
		return idType;
	}
	public void setIdType(IdTypeEntity idType) {
		this.idType = idType;
	}
	public String getIdNumber() {
		return idNumber;
	}
	public void setIdNumber(String idNumber) {
		this.idNumber = idNumber;
	}
	public String getGender() {
		return gender;
	}
	public void setGender(String gender) {
		this.gender = gender;
	}
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public Date getRegisterDate() {
		return registerDate;
	}
	public void setRegisterDate(Date registerDate) {
		this.registerDate = registerDate;
	}
	public Timestamp getLastLoginTime() {
		return lastLoginTime;
	}
	public void setLastLoginTime(Timestamp lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}
	public Integer getLoginTimes() {
		return loginTimes;
	}
	public void setLoginTimes(Integer loginTimes) {
		this.loginTimes = loginTimes;
	}
	public Double getLongitude() {
		return longitude;
	}
	public void setLongitude(Double longitude) {
		this.longitude = longitude;
	}
	public Double getLatitude() {
		return latitude;
	}
	public void setLatitude(Double latitude) {
		this.latitude = latitude;
	}
	public Set<RoleEntity> getRoles() {
		return roles;
	}
	public void setRoles(Set<RoleEntity> roles) {
		this.roles = roles;
	}
	public String getUserRole() {
		StringBuilder sb = new StringBuilder();
		for (RoleEntity role : roles) {
			sb.append(role.getRoleName()).append(",");
		}
		return StringUtils.isBlank(sb.toString())?"":sb.substring(0, sb.length()-1);
	}
	public void setUserRole(String userRole) {
		this.userRole = userRole;
	}
	

}
